/*
 * Copyright (c) 2021.版权所有高金磊
 */

package 领扣算法.A简单题.删列造序;

public class Main {

    public int minDeletionSize(String[] A) {
        if (A.length==0)
            return 0;
        char[][] data = new char[A.length][];
        for (int i = 0; i < A.length; i++) {
            data[i]=A[i].toCharArray();
        }

        int res=0;
        for (int i = 0; i < data[0].length; i++) {
            char middle='a';
            for (char[] datum : data) {
                if (datum[i]<middle){
                  res++;
                  break;
                }
                middle=datum[i];
            }
        }
        return res;
    }
}
